# -*- coding=utf-8 -*-
# Author: Slp
# @Date : 2021-08-25


from time import sleep

from selenium.webdriver.common.by import By

from src.UItest.base_page import BasePage


class LoginPage(BasePage):

    # 页面元素
    user = (By.ID, 'mobile')
    pwd = (By.ID, 'verifyCode')
    sms_button = (By.XPATH, '//*[@id="root"]/div/div/div[2]/form/div[2]/div/div/span/span/span[2]/button/span')
    login_button = (By.XPATH, '//*[@id="root"]/div/div/div[2]/form/div[3]/div/div/span/button')

    def login(self, url, username, password):
        self.open_url(url)
        self.input(self.user, username)
        self.click(self.sms_button)
        self.input(self.pwd, password)
        self.click(self.login_button)
        sleep(1)

